package com.lili.member.service.Impl;

import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lili.member.bean.MemberEvaluation;
import com.lili.member.mapper.MemberEvaluationMapper;
import com.lili.member.service.MemberEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class MemberEvaluationServiceImpl implements MemberEvaluationService {

    @Autowired
    MemberEvaluationMapper memberEvaluationMapper;

    @Override
    public Page<MemberEvaluation> queryByPage(int current, int pageSize, Map map) {
        Page<MemberEvaluation> page=new Page<>(current,pageSize);
        QueryWrapper<MemberEvaluation> wrapper = new QueryWrapper<>();
        String memberName = (String) map.get("memberName");
        if (!StringUtils.isEmpty(memberName)) {
            wrapper.eq("member_name",memberName);
        }
        memberEvaluationMapper.selectPage(page,wrapper);
        return page;
    }

    @Override
    public int delete(String id) {
        return memberEvaluationMapper.deleteById(id);
    }
}
